1. Field of the Invention
The present invention is directed to computer systems; and more particularly, it is directed to the simulation of depth of field effects using computer systems.
2. Description of the Related Art
As the power and complexity of personal computer systems increase, graphics operations are increasingly being performed using dedicated graphics rendering devices referred to as graphics processing units (GPUs). As used herein, the terms “graphics processing unit” and “graphics processor” are used interchangeably. GPUs are often used in removable graphics cards that are coupled to a motherboard via a standardized bus (e.g., AGP or PCI Express). GPUs may also be used in game consoles and in integrated graphics solutions (e.g., for use in some portable computers and lower-cost desktop computers). Although GPUs vary in their capabilities, they may typically be used to perform such tasks as rendering of two-dimensional (2D) graphical data, rendering of three-dimensional (3D) graphical data, accelerated rendering of graphical user interface (GUI) display elements, and digital video playback. A GPU may implement one or more application programmer interfaces (APIs) that permit programmers to invoke the functionality of the GPU.
A GPU may include various built-in and configurable structures for rendering digital images to an imaging device. Digital images may include raster graphics, vector graphics, or a combination thereof. Raster graphics data (also referred to herein as bitmaps) may be stored and manipulated as a grid of individual picture elements called pixels. A bitmap may be characterized by its width and height in pixels and also by the number of bits per pixel. Commonly, a color bitmap defined in the RGB (red, green blue) color space may comprise between one and eight bits per pixel for each of the red, green, and blue channels. An alpha channel may be used to store additional data such as per-pixel transparency values.
Vector graphics data may be stored and manipulated as one or more geometric objects built with geometric primitives. The geometric primitives (e.g., points, lines, polygons, Bézier curves, text characters, etc.) may be based upon mathematical equations to represent parts of vector graphics data in digital images. The geometric objects may typically be located in two-dimensional or three-dimensional space. An object in three-dimensional space may lie on a plane referred to as a layer. To render vector graphics on raster-based imaging devices (e.g., most display devices and printers), the geometric objects are typically converted to raster graphics data in a process called rasterization.
In rendering digital images, the use of depth of field effects may be desired. In traditional photography, a depth of field blur may result from the inability of a camera lens to keep all the elements of the photograph in focus simultaneously. Consequently, elements that are out of focus may be blurred. It may be desirable to simulate such a depth of field effect in a digital image.
In one prior approach to rendering digital images using a depth of field blur, scene information is gathered from several points on the lens of the camera. The scene information is blended during the rendering of a pixel in the image to simulate a depth of field blur. For example, a ray-tracing renderer may use this approach to sample the incoming light from various points on the lens. However, many rays must typically be cast to generate an accurate depth of field blur, thereby unduly increasing the rendering time.
In another prior approach to rendering digital images using a depth of field blur, a renderer applies the depth of field blur to the rendered image as a post process using the depth information stored in the image. For example, a scanline renderer may use this approach by rendering with a pinhole camera and blurring the resulting image based on the distance of each pixel from the camera. However, unless the blur is diffused up to a depth boundary, the blurring may inappropriately mix colors at various depths in the image. Additionally, by requiring an additional process after the image has been rendered, this approach may also unduly increase the rendering time.